import demo1.Cat;
import demo1.Dog;
class Stdeunt{
    private String name="lisi";
    private int age;
    private String stunum;
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public int getAge() {
        return age;
    }
    public void setAge(int age) {
        this.age = age;
    }
    public String getStunum() {
        return stunum;
    }
    public void setStunum(String stunum) {
        this.stunum = stunum;
    }
    public Stdeunt(String name, int age, String stunum){
        this.name=name;
        this.age=age;
        this.stunum=stunum;
        System.out.println("构造方法被执行");
    }
    public Stdeunt(){
        System.out.println("构造代码块");
    }
     static String className="113";
    //实例代码块
    {
        this.name="suzhou";
        System.out.println("实例代码块或者叫构造代码块");
    }
    static {
        className="114";
        System.out.println("静态代码块用来初始化静态成员变量");
    }
    public void show(){
        System.out.println(" 姓名 "+this.name+" 年龄 "+this.age+" 学号 "+this.stunum
    +" 班级 "+className);
        System.out.println(getClassName());
    }
    public static String getClassName(){
        return className;//static方法中不能使用 this
    }

    @Override
    public String toString() {
        return "Stdeunt{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", stunum='" + stunum + '\'' +
                '}';
    }
}
public class Text {
    public static void main(String[] args) {
        Dog dog=new Dog();
        dog.name="大黄";
        dog.age=2;
        dog.eat();
        dog.bark();
        Cat cat=new Cat();
        cat.name="小虎";
        cat.age=1;
        cat.eat();
        cat.mimi();
    }
    public static void main5(String[] args) {
        Stdeunt student =new Stdeunt("lisi",24,"2020210");
        System.out.println(student);
    }
    public static void main4(String[] args) {
        Stdeunt stdeunt=new Stdeunt();
        System.out.println(stdeunt.getName());
    }
    /*public int add(int x,int y){
        return x+y;
    }*/
    public static void main3(String[] args) {
        //Text text=new Text();
        //System.out.println(text.add(1, 2));
        Stdeunt student =new Stdeunt("lisi",24,"2020210");
        //student.show();
        //System.out.println(Stdeunt.className);
        System.out.println(student.getName());
    }
    public static void main2(String[] args) {
       // System.out.println(Stdeunt.className);
    }
    public static void main1(String[] args) {
        Stdeunt student =new Stdeunt("suzhou",24,"2020210");
        //System.out.println(student);
        //System.out.println(Stdeunt.classname);
        student.show();
        Stdeunt student1 =new Stdeunt("zhangsan",22,"2020212");
        student1.show();
        Stdeunt student2 =new Stdeunt("lisi",23,"20202101");
        student2.show();

    }
}